<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<style type="text/css">
@charset "utf-8";
/* -------------------------------------------------
 * form
 * -------------------------------------------------
*/
form {
	margin-bottom: 18px;
	font-size: 13px;
}

textarea {
	resize: none;
	vertical-align: top;
	overflow: auto;
	font: 12px/1.5 Helvetica, Arial, sans-serif;
	width: 200px;
	height: 80px;
}

input,select,label {
	vertical-align: middle;
}

.form-text {
	margin: 0;
	padding: 0;
	font: 12px/1.5 Helvetica, Arial, sans-serif;
	height: 24px;
	width: 200px;
}

.form-text,textarea,select {
	border: 1px solid #CCCCCC;
	border-radius: 3px 3px 3px 3px;
	/*padding: 4px;*/
}

.form-text,textarea {
	-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
	-moz-transition: border linear 0.2s, box-shadow linear 0.2s;
	-ms-transition: border linear 0.2s, box-shadow linear 0.2s;
	-o-transition: border linear 0.2s, box-shadow linear 0.2s;
	transition: border linear 0.2s, box-shadow linear 0.2s;
	-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
	-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
	box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-text:focus,textarea:focus,select {
	outline: 0 none;
}

.form-text:focus,textarea:focus {
	border-color: rgba(82, 168, 236, 0.8);
	-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px
		rgba(82, 168, 236, 0.6);
	-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px
		rgba(82, 168, 236, 0.6);
	box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px
		rgba(82, 168, 236, 0.6);
}

.form-radio,.form-checkbox {
	margin: 0;
	padding: 0;
	width: 13px;
	height: 13px;
	font-size: 13px;
}

:-moz-placeholder,::-webkit-input-placeholder {
	color: #bfbfbf;
}
/* form-item */
.form-item {
	margin-bottom: 9px;
}
/* horizontal form label */
.form-horizontal label {
	float: left;
	text-align: right;
	font-weight: 500;
	width: 100px;
	font-size: 12px;
	line-height: 19px;
}

.form-horizontal .form-field {
	float: left;
}

.form-horizontal .form-action,.form-horizontal .item-no-label {
	padding-left: 100px; /*label width*/
}
/* vertical form label */
.form-vertical label {
	display: block;
	float: none;
	width: auto;
	text-align: left;
	margin-bottom: 5px;
}

.form-vertical .form-field {
	float: none;
}

.form-vertical .form-action,.form-vertical .item-no-label {
	padding-left: 0;
}
/* field-list */
.form-radio-checkbox-wrap .form-field label {
	text-align: left;
	width: auto;
	font-weight: normal;
	margin: 0 10px 0 0;
	float: left;
	display: inline;
}

.form-radio-checkbox-wrap .form-field .field-list-block {
	display: block;
	float: none;
	margin-right: 0;
	overflow: auto;
	*zoom: 1;
}

.form-radio-checkbox-wrap .form-radio,.form-radio-checkbox-wrap .form-checkbox,.form-radio-checkbox-wrap span
	{
	float: left;
	display: inline;
}

.form-radio-checkbox-wrap .form-radio,.form-radio-checkbox-wrap .form-checkbox
	{
	margin-right: 5px;
	margin-top: 3px;
}
/* form-action */
.form-action {
	clear: both;
}

.submit-wrap {
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
	display: inline-block;
	*display: inline;
	*zoom: 1;
}

.submit-btn {
	border: 0 none;
	height: 26px;
	margin: 0;
	background: none;
	overflow: visible;
	padding: 0 10px;
	cursor: pointer;
}

@
-moz-document url-prefix     (){ .submit-btn {
	padding-bottom: 3px;
}

}
/* description */
.form-des {
	color: #bfbfbf;
	font-size: 12px;
	margin-left: 5px;
}

p.form-des {
	margin: 0;
}
/* codePic */
.code-pic {
	display: inline-block;
	*display: inline;
	*zoom: 1;
}

.code-pic img {
	height: 28px;
	vertical-align: middle;
	margin: 0 5px;
}
/* tips messages */
.form-error,.form-alert,.form-notice,.form-success,.form-info {
	border: 2px solid #DDDDDD;
	margin-bottom: 9px;
	padding: 8px;
	font-size: 12px;
}
/* span inline tips */
span.form-error,span.form-alert,span.form-notice,span.form-success,span.form-info
	{
	border-width: 1px;
	display: inline-block;
	*display: inline;
	*zoom: 1;
	line-height: 26px;
	vertical-align: middle;
	padding: 0 5px;
	font-size: 12px;
	margin: 0 0 0 5px;
}

.form-error,.form-alert {
	background: none repeat scroll 0 0 #FBE3E4;
	border-color: #FBC2C4;
	color: #8A1F11;
}

.form-notice {
	background: none repeat scroll 0 0 #FFF6BF;
	border-color: #FFD324;
	color: #514721;
}

.form-info {
	background: none repeat scroll 0 0 #D5EDF8;
	border-color: #92CAE4;
	color: #205791;
}

.form-success {
	background: none repeat scroll 0 0 #E6EFC2;
	border-color: #C6D880;
	color: #264409;
}

.form-error a,.form-alert a,.form-notice a,.form-info a,.form-success a
	{
	text-decoration: underline;
}

.form-error a,.form-alert a {
	color: #8A1F11;
}

.form-notice a {
	color: #514721;
}

.form-info a {
	color: #205791;
}

.form-success a {
	color: #264409;
}
/* clear form-item float */
.form-item:before,.form-item:after {
	content: "";
	display: table;
}

.form-item:after {
	clear: both;
	overflow: hidden;
}

.form-item {
	zoom: 1;
	clear: both;
	margin-bottom: 9px;
}
</style>
<script type="text/javascript">
	var context = '${pageContext.request.contextPath}/admin/sysparam';
	function createColumnMenu() {
		var tmenu = $('<div id="tmenu" style="width:100px;"></div>').appendTo(
				'body');
		var fields = $('#center_table').datagrid('getColumnFields');
		for ( var i = 0; i < fields.length; i++) {
			$('<div iconCls="icon-ok"/>').html(fields[i]).appendTo(tmenu);
		}
		tmenu.menu({
			onClick : function(item) {
				if (item.iconCls == 'icon-ok') {
					$('#center_table').datagrid('hideColumn', item.text);
					tmenu.menu('setIcon', {
						target : item.target,
						iconCls : 'icon-empty'
					});
				} else {
					$('#center_table').datagrid('showColumn', item.text);
					tmenu.menu('setIcon', {
						target : item.target,
						iconCls : 'icon-ok'
					});
				}
			}
		});
	}
	/*提供基类型*/
	var obj = {
		isType : function(aType) {
			var self = this;
			while (self) {
				if (self == aType) {
					return true;
				}
				self = self.Type;
			}
			return false;
		}
	}
	/**Class定义*/
	function Class(baseClass, classDefine) {
		function class_() {
			this.Type = baseClass;
			for ( var member in classDefine) {
				this[member] = classDefine[member];
			}
		}
		;
		class_.prototype = baseClass;
		return new class_();
	}
	/**创建对象*/
	function New(aClass, params) {
		function new_() {
			this.Type = aClass;
			if (aClass.init) {
				aClass.init.apply(this, params);
			}
		}
		;
		new_.prototype = aClass;
		return new new_();
	}
	/*作用域链代理*/
	var proxy = function(func, thisObject) {
		return function() {
			return func.apply(thisObject, arguments);
		}
	};
	/*表单构造器*/
	var FormFactory = {
		createSingleField : function(type, properties) {
			var dom = null;
			if (type != 'select' && type != 'textarea' && type != 'a') {
				dom = document.createElement('input');
				dom['class'] = 'form-text';
				dom['className'] = 'form-text';
				dom['type']=type;
			} else if (type == 'select') {
				dom = document.createElement('select');
				if (properties.store) {
					for ( var i = 0; i < properties.store.length; i++) {
						var item = properties.store[i];
						var op = new Option(item[properties.displayField],
								item[properties.valueField]);
						dom.options.add(op);
					}
				}
			} else if (type == 'textarea') {
				dom = document.createElement('textarea');
				dom.innerHTML = properties['value'] ? properties['value'] : '';
			}
			if (!dom) {
				dom = document.createElement(type);
				dom.innerHTML = properties['innerHTML'];
			}
			if (dom) {
				for ( var p in properties) {
					if (p != 'type' && p != 'label') {
						dom.setAttribute(p, properties[p]);
					}
				}
				if (properties['handler']) {
					dom.onclick = eval(properties['handler']);
				}
				if (properties.label) {
					var domSpan = document.createElement('span');
					var labelDom = document.createElement('label');
					labelDom.innerHTML = properties.label;
					labelDom.setAttribute("for", dom.name);
					domSpan.appendChild(labelDom);
					domSpan.appendChild(dom);
					dom = domSpan;
				}
			}
			return dom;
		},
		createField : function(queryFields) {
			var dom = null;
			if (queryFields.constructor === Array) {
				dom = document.createElement('div');
				dom.id = 'query_fields_div';
				for ( var i = 0; i < queryFields.length; i++) {
					var item = queryFields[i];
					var field = FormFactory.createSingleField(item.type, item);
					dom.appendChild(field);
				}
			} else {
				dom = FormFactory.createSingleField(queryFields.type,
						queryFields);
			}
			return dom;
		}
	};

	var CommonPage = Class(
			obj,
			{
				/*默认配置*/
				config : {
					/*模块名称*/
					moduleName : '',
					width : 600,
					height : 500,
					layout : 'border',
					/*按钮*/
					buttons : [],
					/*查询字段*/
					queryFields : [],
					/*表格配置*/
					gridParams : {
						maxHeight : 600,
						idField : 'id',
						columns : [],
						topBar : []
					},
					/*分页配置*/
					paginationParams : {
						//默认分页大小
						pageSize : 10
					},
					formParams : {
					},
					/*请求配置*/
					requestParams : {
						loadUrlSuffix : '/load.do',
						loadPageUrlSuffix:'/loadPage.do',
						saveUrlSuffix : '/save.do',
						updateUrlSuffix : '/save.do',
						destroyUrlSuffix : 'delete.do'
					}
				},
				/*默认事件处理*/
				actions : {
					saveFormAction : {
						text : Common.Constant.button_submit,
						iconCls : 'icon-ok',
						handler : function() {
							CommonPage.staticSaveRecord();
						}
					},
					closeFormAction : {
						text : Common.Constant.button_cancal,
						iconCls : 'icon-cancel',
						handler : function() {
							/*$(this).dialog("close");*/
							var formId = this.parentNode.parentNode.id;
							$('#' + formId).dialog('close');
						}
					},
					queryAction : {
						type : 'a',
						'class' : 'easyui-linkbutton',
						className : 'easyui-linkbutton',
						iconCls : 'icon-search',
						handler : function() {
							CommonPage.staticQueryRecord();
						},
						innerHTML : '查询'
					}
				},
				getConfig : function() {
					return this.config;
				},
				getBody : function() {
					return document.body;
				},
				initLayout : function() {
					var conf = this.config;
					if (conf.layout == 'border') {
						var mainContainer = document.createElement('div');
						mainContainer.id = 'center_layout';
						mainContainer.className = 'easyui-layout';
						mainContainer.style.width = conf.width;
						mainContainer.style.height = conf.height;

						var northDiv = document.createElement('div');
						northDiv.id = 'north_layout';
						northDiv.region = 'north';
						northDiv.style.overflow = 'hidden';

						var centerDiv = document.createElement('div');
						centerDiv.region = 'center';

						var centerTbl = document.createElement('table');
						var centerTblBody = document.createElement('tbody');
						centerTblBody.id = 'center_table_body';
						centerTbl.appendChild(centerTblBody);

						centerTbl.id = 'center_table';
						/*centerTbl.style.border = '1px solid';*/
						var toolbarDiv = document.createElement('div');
						toolbarDiv.id = 'toolbar';

						centerDiv.appendChild(toolbarDiv);
						centerDiv.appendChild(centerTbl);

						mainContainer.appendChild(northDiv);
						mainContainer.appendChild(centerDiv);
						document
								.getElementById('container_sitemesh')
								.insertBefore(
										mainContainer,
										document
												.getElementById('footer_sitemesh'));
					}
				},
				initQueryFields : function() {
					var conf = this.config;
					var queryFields = document.getElementById(conf.moduleName
							+ 'query_fields');
					var queryFieldsForm = document.createElement('form');
					queryFieldsForm.name = 'query_fields_form';
					queryFieldsForm.method = 'post';
					queryFieldsForm.action = '#';

					if (!queryFields) {
						queryFields = document.createElement('div');
						queryFields.id = conf.moduleName + 'query_fields';
					}
					if (conf.queryFields) {
						queryFieldsForm.appendChild(FormFactory
								.createField(conf.queryFields));
					}
					queryFields.appendChild(queryFieldsForm);
					document.getElementById('north_layout').appendChild(
							queryFields);
				},
				initGrid : function() {
					var conf = this.config;
					var loadUrl = CommonPage.requestContext
							+ this.config.requestParams.loadPageUrlSuffix;
					if (conf.gridParams) {
						$('#center_table')
								.datagrid(
										{
											url : loadUrl,
											width : 'auto',
											height : 'auto',
											/* 是否显示分页*/
											pagination : true,
											/* 是否显示行号*/
											rownumbers : true,
											checkbox : true,
											/* True 就会自动扩大或缩小列的尺寸以适应表格的宽度并且防止水平滚动。*/
											fitColumns : true,
											/* True 就把行条纹化。（即奇偶行使用不同背景色）*/
											striped : true,
											/* 单选*/
											onSelect : function(rowIndex,
													rowData) {
												var id = $('#center_table')
														.datagrid('getSelected');
												if (id != null) {
													var toolbar = document
															.getElementById('toolbar');
													var toolbarBtns = toolbar
															.getElementsByTagName('a');
													for ( var i = 0; i < toolbarBtns.length; i++) {
														$(
																'#'
																		+ toolbarBtns[i].id)
																.linkbutton(
																		{
																			disabled : false
																		});
													}
												}
											},
											onUnselect : function(rowIndex,
													rowData) {
												var id = $('#center_table')
														.datagrid('getSelected');
												if (id == null) {
													var toolbar = document
															.getElementById('toolbar');
													var toolbarBtns = toolbar
															.getElementsByTagName('a');
													for ( var i = 0; i < toolbarBtns.length; i++) {
														var iconCls = toolbarBtns[i].childNodes[0].childNodes[0].getAttribute('class');
														if(iconCls.indexOf('icon-edit')!=-1 || iconCls.indexOf('icon-remove')!=-1)
														{
															$('#'
																	+ toolbarBtns[i].id)
															.linkbutton(
																	{
																		disabled : btnConf['iconCls'] == 'icon-edit'
																				|| btnConf['iconCls'] == 'icon-remove'
																	});
														}
														
													}
												}
											},
											columns : [this.config.gridParams['columns'] ],
											frozenColumns : [ [ {
												field : 'id',
												checkbox : true
											}, ] ],
											onHeaderContextMenu : function(e,
													field) {
												e.preventDefault();
												if (!$('#tmenu').length) {
													createColumnMenu();
												}
												$('#tmenu').menu('show', {
													left : e.pageX,
													top : e.pageY
												});
											}
										});
						/*自适应gird大小*/
						$(window).resize(proxy(function() {
							$('#center_table').datagrid("resize", {
								height : 'auto',
								width : 'auto'
							});
						}, this));
					}
					/*初始化gird顶部工具栏*/
					if (conf.gridParams.topBar) {
						var toolbar = document.getElementById('toolbar');
						for ( var i = 0; i < conf.gridParams.topBar.length; i++) {
							var btnConf = conf.gridParams.topBar[i];
							var opa = document.createElement('a');
							opa.id = btnConf.urlKey;
							opa.plain = true;
							opa.innerHTML = btnConf.text;
							opa.onclick = btnConf.handler ? btnConf.handler
									: CommonPage
											.getDefaultEvent(btnConf['iconCls']);
							toolbar.appendChild(opa);
							$('#' + btnConf.urlKey)
									.linkbutton(
											{
												iconCls : btnConf['iconCls'],
												plain : 'true',
												disabled : btnConf['iconCls'] == 'icon-edit'
														|| btnConf['iconCls'] == 'icon-remove'
											});
						}
					}
					return $('#center_table');
				},
				initForm : function() {
					/*初始化form*/
					var conf = this.config;
					if (conf.formParams) {
						var formdiv = document.getElementById(conf.moduleName
								+ '_form_div');
						if (!this.formdiv) {
							formdiv = document.createElement('div');
							formdiv.id = conf.moduleName + '_form_div';
							formdiv.style.display = 'none';
							formdiv.style.width = 350;
							var form = document.createElement('form');
							form['class'] = 'form-horizontal';
							form['className'] = 'form-horizontal';

							form.id = conf.moduleName + '_form';
							form.name = 'save_edit_form';
							form.method = 'post';
							form.action = '#';
							if (conf.formParams.fields) {
								for ( var i = 0; i < conf.formParams.fields.length; i++) {
									var formItemDiv = null;
									formItemDiv = document.createElement('div');
									formItemDiv['class'] = 'form-item';
									formItemDiv['className'] = 'form-item';

									/*创建FieldLabel*/
									//var fieldLabel = document.createElement('label');
									//fieldLabel.innerHTML = conf.formParams.fields[i].label;
									/**创建FieldDiv*/
									var fieldDiv = document
											.createElement('div');
									fieldDiv['className'] = 'form-field';
									fieldDiv['class'] = 'form-field';

									/*创建Field*/
									var fieldConf = conf.formParams.fields[i];
									var field = FormFactory.createSingleField(
											fieldConf.type, fieldConf);
									fieldDiv.appendChild(field);

									formItemDiv.appendChild(fieldDiv)
									form.appendChild(formItemDiv);
								}
							}
							formdiv.appendChild(form);
							document.body.appendChild(formdiv);
						}
						return $('#' + conf.moduleName + '_form_div');
					}
				},
				getFormRecord : function() {
					var conf = this.config;
					var form_id = conf.moduleName + 'form';
					var form = document.getElementById(form_id);
					if (form) {
						var els = form.elements;
						for ( var i = 0; i < els.length; i++) {
							alert(els[i].name);
						}
					}
				},
				getDefaultEvent : function(btnIconCls) {
					if (btnIconCls == 'icon-add') {
						return proxy(this.openAddForm, this);
					} else if (btnIconCls == 'icon-edit') {
						return proxy(this.openEditForm, this);//.call(this.centerTable.datagrid('getSelected'));
					} else if (btnIconCls == 'icon-remove') {
						return proxy(this.removeRecord, this);
					}
				},
				openAddForm : function() {
					/*初始化新增action*/
					var actions = Array();
					var conf = this.config;
					if (conf.formParams.actions) {
						var action = {};
						for ( var i = 0; i < conf.formParams.actions.length; i++) {
							var actionConf = conf.formParams.actions[i];
							action = actionConf;
							actions.push(action);
						}
					}
					var formId = conf.moduleName + '_form_div';
					$('#' + formId).show();
					$('#' + formId).dialog({
						title : '新增' + conf.descriptionName,
						/* 定义是否显示可折叠按钮*/
						collapsible : false,
						/* 定义是否显示最小化按钮*/
						minimizable : false,
						/* 定义是否显示最大化按钮*/
						maximizable : false,
						/* 定义对话框是否可编辑大小
						// resizable:true,
						// 锁住窗口*/
						modal : true,
						/* closeOnEscape 为true的时候，点击键盘ESC键关闭dialog，*/
						closeOnEscape : true,
						buttons : actions,
						/*首次加载分页参数*/
						queryParams:{
							page:1,
							rows:10
						}
					});
					this.resetForm('save_edit_form');
				},
				openEditForm : function(id) {
					var selectId = $('#center_table').datagrid('getSelected');
					if (selectId == null) {
						$.messager
								.alert(Common.Constant.message_warning,
										Common.Constant.message_warning_data,
										'warning');
					}
					this.openAddForm();
					/*$.ajax({
						type : method ? method : 'post',
						url : url + "?jsoncallback=?",
						dataType : 'json',
						data:data,
						success : function(result){
							callback.call(this,result);
						}
					});*/
					CommonPage.request(CommonPage.requestContext+CommonPage.loadUrlSuffix,'post',{detailId:selectId['id']},proxy(function(){
						this.loadFormData(eval(arguments[0]['data']));
					},this));
				},
				loadFormData:function(){
					var record = arguments.length==1?arguments[0]:null;
					if(record)
					{
						var editform = document.forms['save_edit_form'];
						var els = editform.elements;
						for(var item in record)
						{
							var val = record[item];
							for(var i=0;i<els.length;i++)
							{
								if(item == els[i].name)
								{
									if(els[i].type=='textarea')
									{
										els[i].innerHTML = val;
									}
									else
									{
										els[i].setAttribute('value',val);	
									}
									continue;
								}
							}	
						}
						
					}
				},
				resetForm:function(formname){
					var editform = document.forms[formname];
					var els = editform.elements;
					for(var i=0;i<els.length;i++)
					{
						if(els[i].type=='textarea')
						{
							els[i].innerHTML = '';
						}
						else
						{
							els[i].setAttribute('value','');	
						}
					}
				},
				saveRecord : function() {
					alert('call');
					var record = this.getFormRecord();
					alert(record);
				},
				removeRecord : function(id) {
					var selectId = $('#center_table').datagrid('getSelected');
					if (selectId == null) {
						$.messager
								.alert(Common.Constant.message_warning,
										Common.Constant.message_warning_data,
										'warning');
					}
					CommonPage.request(CommonPage.requestContext+CommonPage.removeUrlSuffix, 'post', {id:selectId['id']}, function(){
						CommonPage.refreshGrid();
					});
				},
				afterRender : function() {
					/*jquery placeholder*/
					$('input,textarea').placeholder();
				},
				init : function(config) {
					this.config = CommonPage.config;
					for ( var c in config) {
						this.config[c] = config[c];
					}
					this.initLayout();
					this.initQueryFields();
					this.initGrid();
					this.initForm();
					this.afterRender();
				}
			});

	/*ajax请求静态方法*/
	CommonPage.request = function(url,method,data,callback) {
		/*alert($.toJSON(data));*/
		$.ajax({
			type : method ? method : 'post',
			url : url,
			dataType : 'json',
			data:data,
			success : function(result){
				callback.call(this,result);
			}
		});
	}

	/*作用域问题，提供静态查询保存方法，安全范围内可以重载*/
	CommonPage.saveUrlSuffix = '/save.do';
	CommonPage.loadUrlSuffix = '/load.do';
	CommonPage.loadPageUrlSuffix = '/loadPage.do';
	CommonPage.removeUrlSuffix = '/remove.do';
	CommonPage.requestContext = '${pageContext.request.contextPath}/admin/sysparam';
	/*静态查询方法*/
	CommonPage.staticQueryRecord = function() {
		var form = document.forms['query_fields_form'];
		if (form) {
			var queryType = 'filter';/*过滤型*/
			var queryParam = {};
			var record = {};
			var els = form.elements;
			for ( var i = 0; i < els.length; i++) {
				if (els[i].type != 'select') {
					record[els[i].name] = els[i].value;
					var rule = els[i].rule;
					if(!rule)
					{
						rule = 'ALLLIKES';
					}
					queryParam[queryType+'_'+rule+'_'+els[i].name]=els[i].value;
				} else if (els[i].type == 'select') {

				}
			}
			/*filter_ALLLIKES_JGH="+escape(escape(jgh))+"&filter_ALLLIKES_XM="+escape(escape(xm))+"&filter_EQUALI_YF="+yf+"&filter_EQUALI_NF="+nf*/
			CommonPage.queryGrid(queryParam);
		}
	}
	/*静态保存方法*/
	CommonPage.staticSaveRecord = function() {
		var form = document.forms[0];
		if (form) {
			var record = {};
			var els = form.elements;
			for ( var i = 0; i < els.length; i++) {
				var el = els[i];
				if (el.type != 'select' && el.type != 'radio'
						&& el.type != 'checkbox') {
					record[els[i].name] = els[i].value;
				} else if (el.type == 'select') {

				} else if (el.type == 'radio') {

				} else if (el.type == 'checkbox') {

				}
			}
			CommonPage.request(context + CommonPage.saveUrlSuffix,'post',record,
					function(data) {
						CommonPage.refreshGrid();
					});
		}
	}

	/*静态刷新方法*/
	CommonPage.refreshGrid = function() {
		$('#center_table').datagrid('reload');
	}
	CommonPage.queryGrid = function(params) {
		$('#center_table').datagrid('load',params);
	}

	$(function() {
		var AccountPage = Class(CommonPage, {
			init : function(config) {
				CommonPage.init.call(this, config);
			}
		});
		var config = [ {
			moduleName : 'systemParam',
			descriptionName : '系统参数',
			height : 400,
			width : 800,
			layout : 'border',
			queryFields : [ {
				label : '名称:',
				type : 'text',
				name : 'name',
				otype:'S',/*对象类型*/
				rule:'ALLLIKES'/*默认是ALLLIKE*/
			}, {
				label : '值:',
				name : 'value',
				type : 'text',
				otype:'S',
				value : ''
			}, {
				label : '键:',
				otype:'S',
				name : 'paramKey',
				type : 'select',
				displayField : 'name',
				valueField : 'value',
				store : [ {
					name:'无',
					value:''
				},{
					name : '男',
					value : '1'
				}, {
					name : '女',
					value : '0'
				} ]
			}, CommonPage.actions.queryAction ],
			formParams : {
				fields : [{
					type:'hidden',
					name:'id'
				}, {
					label : '名称',
					name : 'name',
					type : 'text',
					placeholder : '请输入名称'
				}, {
					label : '键:',
					tpye : 'text',
					name : 'paramKey',
					placeholder : '请输入键'
				}, {
					label : '值:',
					name : 'value',
					type : 'text',
					placeholder : '请输入该键的值'
				}, {
					label : '备注:',
					name : 'memo',
					type : 'textarea',
					rows : 5,
					cols : 10,
					placeholder : '请输入备注信息'
				} ],
				actions : [ CommonPage.actions.saveFormAction,
						CommonPage.actions.closeFormAction ]
			},
			gridParams : {
				maxHeight : 600,
				idField : 'id',
				columns : [ {
					field : 'id',
					title : '编号',
					width : 80
				}, {
					field : 'name',
					title : '名称',
					width : 120
				}, {
					field : 'paramKey',
					title : '键',
					width : 80,
					align : 'right'
				}, {
					field : 'value',
					title : '值',
					width : 80,
					align : 'right'
				} ],
				topBar : [ {
					urlKey : 'addAccount',
					text : '增加',
					iconCls : 'icon-add'
				}, {
					urlKey : 'updateAccount',
					text : '修改',
					iconCls : 'icon-edit'
				}, {
					urlKey : 'removeAccount',
					text : '删除',
					iconCls : 'icon-remove'
				} ]
			}
		} ];
		var page = New(AccountPage, config);
	});
</script>
</head>
<body>
</body>
</html>